package com.qf.fcy.youshare;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import com.qf.fcy.youshare.fragment.StorePlatformFragment;

/**
 * Created with IntelliJ IDEA.
 * User: Alex[FR]
 * Date: 2015/2/7
 * Email: alex_fcy@163.com
 */
public class SubCategoryActivity extends FragmentActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sub_category);

        // 第一步 通过平台产品分类点击，进入这个界面
        // 进入之后，传递一个点击的那个分类的ID
        // 更新StorePlatformFragment 的设计，使其支持动态的分类列表获取

        Intent intent = getIntent();
        // 获取分类ID
        String cid = intent.getStringExtra(Constants.INTENT_KEY_CATEGORY_ID);
        if (cid == null) {
            cid = "2";
        }

        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        StorePlatformFragment fragment = new StorePlatformFragment();

        //
        Bundle args = new Bundle();
        args.putString(Constants.INTENT_KEY_CATEGORY_ID,cid);
        fragment.setArguments(args);
        transaction.add(R.id.sub_category_container, fragment);
        transaction.commit();

    }
}